/**
 * package: request
 * author: zhaiyujin
 * description:
 */
package request

import (
	"errors"
	"github.com/kataras/iris/v12"
)

type NewPassword struct {
	NewPassword string `json:"new_password"`
	NewPasswordAgain string `json:"new_password_again"`
	OldPassword	string `json:"old_password"`
}

func (n *NewPassword) ValidateInfo(m *NewPassword,ctx iris.Context)error{

		err:=ctx.ReadJSON(m)
		if err!=nil{
			return err
		}
		if m.NewPassword==""||m.NewPasswordAgain==""{
			return errors.New("密码不能为空")
		}
		if m.NewPassword!=m.NewPasswordAgain{
			return errors.New("密码不一样")
		}

	return nil
}
